<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{padding: 0; margin: 5px;}
#log{height: 300px; overflow-y: scroll; background: #CCC;}
.v-error{border: 1px solid #F00; color: #F00;}
</style>
</head>

<body>

<form id="testForm">
单行文本，必填：<input id="f1" type="text" />
<br />
下拉菜单，必选：<select id="f2"><option value="-1">---</option><option value="a">a</option><option value="b">b</option><option value="c">c</option></select>
<div id="radios">
单选按钮，必选：
<label><input type="radio" value="test1" id="" />test1</label><label><input type="radio" value="test2" id="" />test2</label><label><input type="radio" value="test3" id="" />test3</label>
</div>
<div id="checks">
复选菜单，选择2-3个：
<label><input type="checkbox" value="test1" id="" />test1</label><label><input type="checkbox" value="test2" id="" />test2</label><label><input type="checkbox" value="test3" id="" />test3</label><label><input type="checkbox" value="test4" id="" />test4</label><label><input type="checkbox" value="test5" id="" />test5</label>
</div>
<div id="texts">
浮点数，A小于B
<input type="text" value="" id="test" /><input type="text" value="" id="test2" />
</div>
<br />
密码：
<input type="password" id="pswd" />
<br />
再次输入：
<input type="password" id="re-pswd"/>
<br />
多行文本框，大于10，小于100：
<textarea id="textarea"></textarea>
<br />
日期，匹配'yyyy-MM-dd'：
<input id="datetime" type="text" />
<br />
<input type="submit" value="submit" /><input type="reset" value="reset" />
</form>

<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />

<script src="prototype.js"></script>
<script src="effects.js"></script>
<script src="validate.js"></script>
<script>
new Validate.Form('testForm', [
	new Validate.Element('f1', 'required'),
	new Validate.Element('f2', 'required'),
	new Validate.Group($('checks').select('input'), [['minLen', 2], ['maxLen', 3]]),
	new Validate.Group($('radios').select('input'), [['minLen', 1]]),
	new Validate.Group($('texts').select('input'), ['isFloat', 'lessThen']),
	new Validate.Group(['pswd', 're-pswd'], ['required', 'equal']),
	new Validate.Element('textarea', [['minLen', 10], ['maxLen', 100]]),
	new Validate.Element('datetime', [['isDatetime']])
], {stopAtFirst: false})



</script>




</body>
</html>
